<!DOCTYPE >
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>基本设置</title>
<css  href="__PUBLIC__/system/css/right.css" />
<js href="__PUBLIC__/system/js/jquery.js" />
<js href="__PUBLIC__/system/js/admin.js" />
<js href="__PUBLIC__/system/js/system.js" />
<js href="__PUBLIC__/system/js/ajaxfileupload.js" />
</head>
<body style="overflow: auto;">
	<div class="basic bor">
			<div class="title fl">当前位置：导航管理</div>
			<div class="basic_r fr"><a href="{:U('Index/setting')}">基本信息</a></div>
	</div>
	<form action="{:U('Nav/addmenu')}" method="post"  enctype="multipart/form-data">
	<div class="addnav">
		<span class="navname">菜单名称：</span>
		<input class="input127" type="text" name="name">
		<span class="navurl">连接：</span>
		<input class="input188" type="text" name="url">
		<div class="infx blocks">
        <input class="infile" type="file"   name="ico" value="">
        <span class="text_s">上传文件</span>
        </div>
		<span class="newx">弹出新窗口：</span>		
		<input class="checkbox bor" name="blank"  type="radio" value="1" />
		<span class="yes">是</span>
		<input class="checkbox bor" name="blank"  checked="checked"  type="radio" value="0" />
		<span class="no">否</span>		
        <input type="hidden" name = "pid" value = "{$_GET['uid']}">
		<input class="submit" name="submit" type="submit" value="添加" />
	</div>
	</form>
	
<table border="1"  id="resText" class="table table-hover text-center">
  <tr class="trcolor">
   	<td>排序</td>
	<td>菜单名称</td>
	<td>图标</td>
    <td>菜单等级</td>
    <td>连接</td>
    <td colspan="2">操作</td>
    <td>弹窗</td>
  </tr>

<!-- ============================================================= -->


<volist name='list' id='li' key = "k">
  <tr>
    <td>
    <input class="orde"  onchange='onid("{$li.id}","sort","store_menu")' sort_id="{$li.id}" type="text" name="sort" value="{$li.sort}"></td>
    <td class="textleft_lover"><span class="bg_clo">{$li.html}</span><input type="text" onchange='onid("{$li.id}","name","store_menu")' name_id="{$li.id}"  name="name" value="{$li.name}"></td>
     <td class="color12">
        <div class="fileadd">
            <input type="file"  class="imputs" data-id ='{$li.id}' data-key = "{$k}"  id="pic_{$k}" name="ico" >
            <img src="{$li.ico}" height="45" width="50" class="ico" id="img_{$k}">
        </div>
    </td>
    <td class="color12">{$li.level}级菜单</td>
    <td><input type="text" onchange='onid("{$li.id}","url","store_menu")' url_id="{$li.id}" name="url" class="color14" value="{$li.url}"></td>
    <td><span class="addname">
	<if condition="$li[level] neq 2 "><a href="{:U('Nav/addlevel',array('id'=>$li[id],'uid'=>$li[pid]))}" >添加子菜单</a></if>
    </span></td>
    <td><span class="addname"><a href="{:U('Nav/delmenu',array('id'=>$li[id],'uid'=>$_GET[uid]))}"  onclick="return confirm('确定将此记录删除?')">删除</a></span></td>
    <td><input class="checkbox bor"
        <if condition="$li[blank] eq 1 ">checked="checked"</if>
      onclick="onid('{$li.id}','blank','store_menu'
      )" blank_id="{$li.id}"  type="checkbox" name="blank" value="{$li.blank}" /></td>
  </tr>
</volist>

<!-- ============================================================= -->

</table>
<script>
 

 $(function () {
        $(".imputs").change(function () {
            var $this = $(this); 
            var key = $this.attr('data-key');
            var id = $this.attr("data-id");
             $.ajaxFileUpload
            (
                {
                    url: "{:U('Nav/Upload')}", //用于文件上传的服务器端请求地址
                    type: 'post',
                    data: { Id: id, Key: key }, //此参数非常严谨，写错一个引号都不行
                    secureuri: false, //一般设置为false
                    fileElementId: 'pic_'+key, //文件上传空间的id属性  <input type="file" id="file" name="file" />
                    dataType: 'json', //返回值类型 一般设置为json
                    success: function (data, status)  //服务器成功响应处理函数
                    { 
                        if(data.status == 1){
                            $("#img_"+data.key).attr('src',data.imgurl);
                        }
                   
                    },
                    error: function (data, status, e)//服务器响应失败处理函数
                    {
                        alert(e);
                    }
                }
            );
        });

});
  
</script>
<!-- 提示 -->
<p class="ts"><span class="colorf00">*</span><span class="ts_text">如果要修改分类名称/排序请直接点击文字修改。</span></p>
</body>
</html>